<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Easy-Trans | Easy-Trans</title>
    <meta name="description" content="Easy_trans Easy-Trans EasyTrans">
    <link rel="preload stylesheet" href="/assets/style.410e78d7.css" as="style">
    <link rel="modulepreload" href="/assets/app.32964c21.js">
    <link rel="modulepreload" href="/assets/components_cache.md.cd64e4ce.lean.js">
    
    <script id="check-dark-light">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
  </head>
  <body>
    <div id="app"><div class="Layout" data-v-e43435dc><!--[--><!--]--><!--[--><span tabindex="-1" data-v-ef0c98d4></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-ef0c98d4> Skip to content </a><!--]--><!----><header class="VPNav" data-v-e43435dc data-v-74f0f766><div class="VPNavBar has-sidebar" data-v-74f0f766 data-v-f86e64a6><div class="container" data-v-f86e64a6><div class="VPNavBarTitle has-sidebar" data-v-f86e64a6 data-v-c0a61e2e><a class="title" href="/" data-v-c0a61e2e><!--[--><!--]--><!----><!--[-->Easy-Trans<!--]--><!--[--><!--]--></a></div><div class="content" data-v-f86e64a6><!--[--><!--]--><!----><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-f86e64a6 data-v-8d86e7a0><span id="main-nav-aria-label" class="visually-hidden" data-v-8d86e7a0>Main Navigation</span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/" data-v-8d86e7a0 data-v-711cb0e6 data-v-f1e8080e><!--[-->首页<!--]--><!----></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/components/readme.html" data-v-8d86e7a0 data-v-711cb0e6 data-v-f1e8080e><!--[-->文档<!--]--><!----></a><!--]--><!--[--><div class="VPFlyout VPNavBarMenuGroup" data-v-8d86e7a0 data-v-470bc32f><button type="button" class="button" aria-haspopup="true" aria-expanded="false" data-v-470bc32f><span class="text" data-v-470bc32f><!----> 友情链接 <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="text-icon" data-v-470bc32f><path d="M12,16c-0.3,0-0.5-0.1-0.7-0.3l-6-6c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l5.3,5.3l5.3-5.3c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-6,6C12.5,15.9,12.3,16,12,16z"></path></svg></span></button><div class="menu" data-v-470bc32f><div class="VPMenu" data-v-470bc32f data-v-611c84af><div class="items" data-v-611c84af><!--[--><!--[--><div class="VPMenuLink" data-v-611c84af data-v-678b83d2><a class="VPLink link" href="https://gitee.com/fhs-opensource/iparking" target="_blank" rel="noreferrer" data-v-678b83d2 data-v-f1e8080e><!--[-->Iparking停车系统<!--]--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" height="24px" viewbox="0 0 24 24" width="24px" class="icon" data-v-f1e8080e><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z"></path></svg></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-611c84af data-v-678b83d2><a class="VPLink link" href="https://mp.baomidou.com/" target="_blank" rel="noreferrer" data-v-678b83d2 data-v-f1e8080e><!--[-->Mybatis Plus<!--]--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" height="24px" viewbox="0 0 24 24" width="24px" class="icon" data-v-f1e8080e><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z"></path></svg></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-611c84af data-v-678b83d2><a class="VPLink link" href="https://xiaonuo.vip/" target="_blank" rel="noreferrer" data-v-678b83d2 data-v-f1e8080e><!--[-->小诺开源技术<!--]--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" height="24px" viewbox="0 0 24 24" width="24px" class="icon" data-v-f1e8080e><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z"></path></svg></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-611c84af data-v-678b83d2><a class="VPLink link" href="https://bs.zhxu.cn/" target="_blank" rel="noreferrer" data-v-678b83d2 data-v-f1e8080e><!--[-->Bean Searcher<!--]--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" height="24px" viewbox="0 0 24 24" width="24px" class="icon" data-v-f1e8080e><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z"></path></svg></a></div><!--]--><!--[--><div class="VPMenuLink" data-v-611c84af data-v-678b83d2><a class="VPLink link" href="http://www.cptcsoft.com/" target="_blank" rel="noreferrer" data-v-678b83d2 data-v-f1e8080e><!--[-->陕西小伙伴网络科技<!--]--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" height="24px" viewbox="0 0 24 24" width="24px" class="icon" data-v-f1e8080e><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5H9z"></path></svg></a></div><!--]--><!--]--></div><!--[--><!--]--></div></div></div><!--]--><!--]--></nav><!----><div class="VPNavBarAppearance appearance" data-v-f86e64a6 data-v-89b6e992><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" aria-label="toggle dark mode" aria-checked="false" data-v-89b6e992 data-v-fabf0437 data-v-fcfba2df><span class="check" data-v-fcfba2df><span class="icon" data-v-fcfba2df><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-fabf0437><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-fabf0437><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-f86e64a6 data-v-1df93feb data-v-a6cb727e><!--[--><a class="VPSocialLink" href="https://gitee.com/dromara/easy_trans" target="_blank" rel="noopener" data-v-a6cb727e data-v-8a45e5aa><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-f86e64a6 data-v-72579bfd data-v-470bc32f><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-470bc32f><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="icon" data-v-470bc32f><circle cx="12" cy="12" r="2"></circle><circle cx="19" cy="12" r="2"></circle><circle cx="5" cy="12" r="2"></circle></svg></button><div class="menu" data-v-470bc32f><div class="VPMenu" data-v-470bc32f data-v-611c84af><!----><!--[--><!--[--><!----><div class="group" data-v-72579bfd><div class="item appearance" data-v-72579bfd><p class="label" data-v-72579bfd>Appearance</p><div class="appearance-action" data-v-72579bfd><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" aria-label="toggle dark mode" aria-checked="false" data-v-72579bfd data-v-fabf0437 data-v-fcfba2df><span class="check" data-v-fcfba2df><span class="icon" data-v-fcfba2df><!--[--><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="sun" data-v-fabf0437><path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path><path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path><path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path><path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path><path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path><path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path><path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path><path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path><path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path></svg><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="moon" data-v-fabf0437><path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path></svg><!--]--></span></span></button></div></div></div><div class="group" data-v-72579bfd><div class="item social-links" data-v-72579bfd><div class="VPSocialLinks social-links-list" data-v-72579bfd data-v-a6cb727e><!--[--><a class="VPSocialLink" href="https://gitee.com/dromara/easy_trans" target="_blank" rel="noopener" data-v-a6cb727e data-v-8a45e5aa><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-f86e64a6 data-v-ca594f6c><span class="container" data-v-ca594f6c><span class="top" data-v-ca594f6c></span><span class="middle" data-v-ca594f6c></span><span class="bottom" data-v-ca594f6c></span></span></button></div></div></div><!----></header><div class="VPLocalNav" data-v-e43435dc data-v-896b38fc><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-896b38fc><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewbox="0 0 24 24" class="menu-icon" data-v-896b38fc><path d="M17,11H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,11,17,11z"></path><path d="M21,7H3C2.4,7,2,6.6,2,6s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,7,21,7z"></path><path d="M21,15H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h18c0.6,0,1,0.4,1,1S21.6,15,21,15z"></path><path d="M17,19H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h14c0.6,0,1,0.4,1,1S17.6,19,17,19z"></path></svg><span class="menu-text" data-v-896b38fc>Menu</span></button><a class="top-link" href="#" data-v-896b38fc> Return to top </a></div><aside class="VPSidebar" data-v-e43435dc data-v-3600ae57><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-3600ae57><span class="visually-hidden" id="sidebar-aria-label" data-v-3600ae57> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-3600ae57><section class="VPSidebarGroup" data-v-3600ae57 data-v-d8b6faf3><div class="title" data-v-d8b6faf3><h2 class="title-text" data-v-d8b6faf3>文档</h2><div class="action" data-v-d8b6faf3><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewbox="0 0 24 24" class="icon minus" data-v-d8b6faf3><path d="M19,2H5C3.3,2,2,3.3,2,5v14c0,1.7,1.3,3,3,3h14c1.7,0,3-1.3,3-3V5C22,3.3,20.7,2,19,2zM20,19c0,0.6-0.4,1-1,1H5c-0.6,0-1-0.4-1-1V5c0-0.6,0.4-1,1-1h14c0.6,0,1,0.4,1,1V19z"></path><path d="M16,11H8c-0.6,0-1,0.4-1,1s0.4,1,1,1h8c0.6,0,1-0.4,1-1S16.6,11,16,11z"></path></svg><svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" class="icon plus" data-v-d8b6faf3><path d="M19,2H5C3.3,2,2,3.3,2,5v14c0,1.7,1.3,3,3,3h14c1.7,0,3-1.3,3-3V5C22,3.3,20.7,2,19,2z M20,19c0,0.6-0.4,1-1,1H5c-0.6,0-1-0.4-1-1V5c0-0.6,0.4-1,1-1h14c0.6,0,1,0.4,1,1V19z"></path><path d="M16,11h-3V8c0-0.6-0.4-1-1-1s-1,0.4-1,1v3H8c-0.6,0-1,0.4-1,1s0.4,1,1,1h3v3c0,0.6,0.4,1,1,1s1-0.4,1-1v-3h3c0.6,0,1-0.4,1-1S16.6,11,16,11z"></path></svg></div></div><div class="items" data-v-d8b6faf3><!--[--><!--[--><a class="VPLink link link" href="/components/readme.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>介绍</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/basic.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>基础使用(必读)</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/trans.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>Trans注解详解(必读)</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link active" href="/components/cache.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>缓存使用</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/micro-service.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>微服务</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/dict.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>字典详解</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/datasource.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>多数据源</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/simple-default-sett.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>SIMPLE默认配置</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/tile.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>平铺模式</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/cascade.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>级联翻译</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/auto.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>AUTO_TRANS使用</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/untrans.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>反向翻译</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/trans-sett.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>指定字段</span><!--]--><!----></a><!----><!--]--><!--[--><a class="VPLink link link" href="/components/faq.html" style="padding-left:0px;" tabindex="-1" data-v-3e905354 data-v-f1e8080e><!--[--><span class="link-text" data-v-3e905354>常见问题</span><!--]--><!----></a><!----><!--]--><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-e43435dc data-v-c9eb02e7><div class="VPDoc has-sidebar has-aside" data-v-c9eb02e7 data-v-00dd4a56><div class="container" data-v-00dd4a56><div class="aside" data-v-00dd4a56><div class="aside-curtain" data-v-00dd4a56></div><div class="aside-container" data-v-00dd4a56><div class="aside-content" data-v-00dd4a56><div class="VPDocAside" data-v-00dd4a56 data-v-23c84eb8><!--[--><!--]--><!--[--><!--]--><div class="VPDocAsideOutline" data-v-23c84eb8 data-v-c5971da2><div class="content" data-v-c5971da2><div class="outline-marker" data-v-c5971da2></div><div class="outline-title" data-v-c5971da2>On this page</div><nav aria-labelledby="doc-outline-aria-label" data-v-c5971da2><span class="visually-hidden" id="doc-outline-aria-label" data-v-c5971da2> Table of Contents for current page </span><ul class="root" data-v-c5971da2 data-v-1319b2eb><!--[--><!--]--></ul></nav></div></div><!--[--><!--]--><div class="spacer" data-v-23c84eb8></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-00dd4a56><div class="content-container" data-v-00dd4a56><!--[--><!--]--><main class="main" data-v-00dd4a56><div style="position:relative;" class="vp-doc _components_cache" data-v-00dd4a56><div><h2 id="_1、缓存开启" tabindex="-1">1、缓存开启 <a class="header-anchor" href="#_1、缓存开启" aria-hidden="true">#</a></h2><h3 id="_1-1-字典缓存" tabindex="-1">1.1 字典缓存 <a class="header-anchor" href="#_1-1-字典缓存" aria-hidden="true">#</a></h3><p>字典默认使用hashmap来存放缓存，我们也支持使用redis 来组二级缓存，这样内存中没有的时候会自动去redis里面找，然后放到内存中，解决了多微服务字典问题，也保证了性能。<br> 开启方式：</p><div class="language-yaml"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="shiki material-palenight"><code><span class="line"><span style="color:#F07178;">easy-trans</span><span style="color:#89DDFF;">:</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span><span style="color:#F07178;">dict-use-redis</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">:</span><span style="color:#A6ACCD;"> </span><span style="color:#FF9CAC;">true</span><span style="color:#A6ACCD;"> </span></span>
<span class="line"></span></code></pre></div><h3 id="_1-2-simple-翻译缓存" tabindex="-1">1.2 SIMPLE 翻译缓存 <a class="header-anchor" href="#_1-2-simple-翻译缓存" aria-hidden="true">#</a></h3><p>可以使用@TransDefaultSett 来开启SIMPLE的缓存功能，只需要给数据源PO类上加@TransDefaultSett(isUseCache = true) 即可。<br> 可选参数：</p><ol><li>isUseCache 是否开启 缓存 默认为false 需要开启设置为true即可</li><li>cacheSeconds 缓存失效时间 单位秒 默认5</li><li>maxCache 最大缓存数量 默认为1000</li><li>isAccess 默认false 设置为true的话会按照最后一次访问时间 进行缓存过期计时 false按照添加时间计时</li></ol><h3 id="_1-3-rpc-翻译缓存" tabindex="-1">1.3 RPC 翻译缓存 <a class="header-anchor" href="#_1-3-rpc-翻译缓存" aria-hidden="true">#</a></h3><p>在配置类上添加:</p><div class="language-java"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki material-palenight"><code><span class="line"><span style="color:#A6ACCD;">         </span><span style="color:#89DDFF;">@</span><span style="color:#C792EA;">Autowired</span></span>
<span class="line"><span style="color:#A6ACCD;">         </span><span style="color:#C792EA;">private</span><span style="color:#A6ACCD;"> </span><span style="color:#C792EA;">TransCacheManager</span><span style="color:#A6ACCD;"> transCacheManager</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;">         transCacheManager</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">setRpcTransCache</span><span style="color:#89DDFF;">(</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">com.fhs.test.pojo.School</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">,</span></span>
<span class="line"><span style="color:#A6ACCD;">                  SimpleTransService</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">TransCacheSett</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">builder</span><span style="color:#89DDFF;">().</span><span style="color:#82AAFF;">cacheSeconds</span><span style="color:#89DDFF;">(</span><span style="color:#F78C6C;">20</span><span style="color:#89DDFF;">).</span><span style="color:#82AAFF;">maxCache</span><span style="color:#89DDFF;">(</span><span style="color:#F78C6C;">1000</span><span style="color:#89DDFF;">).</span><span style="color:#82AAFF;">build</span><span style="color:#89DDFF;">());</span></span>
<span class="line"></span></code></pre></div><p>TransCacheSett 类同样包含 cacheSeconds、 maxCache、 isAccess 3个参数。 上面这段代码要配置到消费者对应微服务中，比如Order中要翻译userid order和user是2个微服务，要把代码放到order微服务里，而不是user微服务。<br> SimpleTransService.TransCacheSett 使用build构造的时候默认值不起作用，会导致缓存配置不起作用，所以cacheSeconds和maxCache都要手动指定。</p><h2 id="_2、缓存刷新-清理" tabindex="-1">2、缓存刷新/清理 <a class="header-anchor" href="#_2、缓存刷新-清理" aria-hidden="true">#</a></h2><h3 id="_2-1-字典缓存" tabindex="-1">2.1 字典缓存 <a class="header-anchor" href="#_2-1-字典缓存" aria-hidden="true">#</a></h3><p>在微服务模式下，如果修改了某个字典，可以通过以下方式刷新各个微服务字典：</p><div class="language-java"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki material-palenight"><code><span class="line"><span style="color:#A6ACCD;">      </span><span style="color:#C792EA;">Map</span><span style="color:#89DDFF;">&lt;</span><span style="color:#C792EA;">String</span><span style="color:#89DDFF;">,</span><span style="color:#C792EA;">String</span><span style="color:#89DDFF;">&gt;</span><span style="color:#A6ACCD;"> transMap </span><span style="color:#89DDFF;">=</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;font-style:italic;">new</span><span style="color:#A6ACCD;"> </span><span style="color:#C792EA;">HashMap</span><span style="color:#89DDFF;">&lt;&gt;();</span></span>
<span class="line"><span style="color:#A6ACCD;">      transMap</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">put</span><span style="color:#89DDFF;">(</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">0</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">,</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">男</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">);</span></span>
<span class="line"><span style="color:#A6ACCD;">      transMap</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">put</span><span style="color:#89DDFF;">(</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">1</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">,</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">女</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">);</span></span>
<span class="line"><span style="color:#A6ACCD;">      dictionaryTransService</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">refreshCacheAndNoticeOtherService</span><span style="color:#89DDFF;">(</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">gender</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">,</span><span style="color:#A6ACCD;">transMap</span><span style="color:#89DDFF;">);</span></span>
<span class="line"></span></code></pre></div><p>当执行了上面的代码后，easy trans会刷新redis的缓存，然后清理掉各个微服务的内存缓存 重新获取redis中的缓存。</p><h3 id="_2-2-simple-rpc-翻译缓存清理" tabindex="-1">2.2 SIMPLE RPC 翻译缓存清理 <a class="header-anchor" href="#_2-2-simple-rpc-翻译缓存清理" aria-hidden="true">#</a></h3><div class="language-java"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki material-palenight"><code><span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#89DDFF;">@</span><span style="color:#C792EA;">Autowired</span></span>
<span class="line"><span style="color:#A6ACCD;">        </span><span style="color:#C792EA;">private</span><span style="color:#A6ACCD;"> </span><span style="color:#C792EA;">TransCacheManager</span><span style="color:#A6ACCD;"> transCacheManager</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;">        transCacheManager</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">clearCache</span><span style="color:#89DDFF;">(</span><span style="color:#A6ACCD;">User</span><span style="color:#89DDFF;">.</span><span style="color:#A6ACCD;">class</span><span style="color:#89DDFF;">,</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">1</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">);</span></span>
<span class="line"></span></code></pre></div><p>通过上述代码即可清理掉本微服务和其他微服务的所有跟User相关的SIMPLE和RPC缓存。 PS：如果要清理掉其他微服务的RPC缓存，需要使用Redis。因为我用redis做了广播去清理。</p><h2 id="_3、uniquefield-使用缓存" tabindex="-1">3、uniqueField 使用缓存 <a class="header-anchor" href="#_3、uniquefield-使用缓存" aria-hidden="true">#</a></h2><p>注意：暂时不支持uniqueField 和 pkey相同字段 比如 主键有个1 uniqueField 还有一个1 他们代表不同的数据。<br> 通过以下方式来配置User除了主键外 还要根据身份证号码字段进行缓存匹配</p><div class="language-java"><button title="Copy Code" class="copy"></button><span class="lang">java</span><pre class="shiki material-palenight"><code><span class="line"><span style="color:#A6ACCD;">transCacheManager</span><span style="color:#89DDFF;">.</span><span style="color:#82AAFF;">setUniqueFieldCache</span><span style="color:#89DDFF;">(</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">com.xx.User</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">,</span><span style="color:#89DDFF;">&quot;</span><span style="color:#C3E88D;">idNo</span><span style="color:#89DDFF;">&quot;</span><span style="color:#89DDFF;">);</span></span>
<span class="line"></span></code></pre></div></div></div></main><!--[--><!--]--><footer class="VPDocFooter" data-v-00dd4a56 data-v-10bf58d5><div class="edit-info" data-v-10bf58d5><div class="edit-link" data-v-10bf58d5><a class="VPLink link edit-link-button" href="https://gitee.com/fhs-opensource/vite_press_easy_trans/tree/master/docs/components/cache.md" target="_blank" rel="noreferrer" data-v-10bf58d5 data-v-f1e8080e><!--[--><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 24 24" class="edit-link-icon" data-v-10bf58d5><path d="M18,23H4c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h7c0.6,0,1,0.4,1,1s-0.4,1-1,1H4C3.4,5,3,5.4,3,6v14c0,0.6,0.4,1,1,1h14c0.6,0,1-0.4,1-1v-7c0-0.6,0.4-1,1-1s1,0.4,1,1v7C21,21.7,19.7,23,18,23z"></path><path d="M8,17c-0.3,0-0.5-0.1-0.7-0.3C7,16.5,6.9,16.1,7,15.8l1-4c0-0.2,0.1-0.3,0.3-0.5l9.5-9.5c1.2-1.2,3.2-1.2,4.4,0c1.2,1.2,1.2,3.2,0,4.4l-9.5,9.5c-0.1,0.1-0.3,0.2-0.5,0.3l-4,1C8.2,17,8.1,17,8,17zM9.9,12.5l-0.5,2.1l2.1-0.5l9.3-9.3c0.4-0.4,0.4-1.1,0-1.6c-0.4-0.4-1.2-0.4-1.6,0l0,0L9.9,12.5z M18.5,2.5L18.5,2.5L18.5,2.5z"></path></svg> Edit this page<!--]--><!----></a></div><!----></div><div class="prev-next" data-v-10bf58d5><div class="pager" data-v-10bf58d5><a class="pager-link prev" href="/components/trans.html" data-v-10bf58d5><span class="desc" data-v-10bf58d5>Previous page</span><span class="title" data-v-10bf58d5>Trans注解详解(必读)</span></a></div><div class="has-prev pager" data-v-10bf58d5><a class="pager-link next" href="/components/micro-service.html" data-v-10bf58d5><span class="desc" data-v-10bf58d5>Next page</span><span class="title" data-v-10bf58d5>微服务</span></a></div></div></footer><!--[--><!--]--></div></div></div></div></div><footer class="VPFooter has-sidebar" data-v-e43435dc data-v-486d8f4e><div class="container" data-v-486d8f4e><p class="message" data-v-486d8f4e>Apache 2.0 Licensed<a href="http://beian.miit.gov.cn" target="_blank" data-v-42913a4d=""> 
陕ICP备2022006153号-2 </a></p><p class="copyright" data-v-486d8f4e>Copyright © 2019-2023 陕西小伙伴网络科技有限公司</p></div></footer><!--[--><!--]--></div></div>
    <script>__VP_HASH_MAP__ = JSON.parse("{\"components_simple-default-sett.md\":\"3768a7e1\",\"components_trans-sett.md\":\"1df77ec1\",\"components_basic.md\":\"0d13099b\",\"components_micro-service.md\":\"bb260774\",\"components_cache.md\":\"cd64e4ce\",\"components_datasource.md\":\"5dff6a29\",\"components_trans.md\":\"331a028d\",\"components_auto.md\":\"6d4ab4a0\",\"components_readme.md\":\"5be2e30a\",\"components_untrans.md\":\"6b007320\",\"components_faq.md\":\"ce886de1\",\"components_repeat_check.md\":\"c68b2a3f\",\"components_cascade.md\":\"02e9ca21\",\"components_tile.md\":\"3af163b0\",\"components_dict.md\":\"dd3d7122\",\"index.md\":\"b4ae228d\",\"components_ms_role.md\":\"3046bcd6\",\"components_pagex_crud.md\":\"42784e6e\"}")</script>
    <script type="module" async src="/assets/app.32964c21.js"></script>
    
  </body>
</html>